<html>
<head></head>
<body>
<script type="text/javascript">
		document.domain = '51.com';
		var iframe,pageisloaded=false;   
		function crossDomain(){

			var c = document.createElement("IFRAME");
				c.id = "_ajax_iframediv_";
				c.style.cssText = "display:none";
				c.src = 'http://lvxy2.51.com/proxy_iframe.html';
				c.is_loading = false;
				c.pageisloaded = false;								
				c.onload = c.onreadystatechange = function() {
					if (this.readyState != "interactive"){c.pageisloaded = pageisloaded = true;}
				};
				document.body.insertBefore(c, document.getElementsByTagName("BODY")[0].getElementsByTagName("*")[0])

                iframe=document.getElementById('_ajax_iframediv_').contentWindow;
                sendAjax();
		}
		function sendAjax(){
           var ajaxTimer=0;
              try{
                   var e = iframe.xht();
                   
                   ajaxTimer = 0;
                    e.open('POST','http://lvxy2.51.com/data.php',true);
                    e.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				    e.onreadystatechange = function () {
					    if (e.readyState == 4) {
					        //document.getElementById("ajax").innerHTML = e.responseText;
					        callback(e.responseText);
				            iframe.xht = null;
					    }
				    };               
                   e.send('aa=bb&cc=dd');               
              }catch(e){
                   if(ajaxTimer<100){
                       ajaxTimer = setTimeout(function(){
                         sendAjax();  
                       },100);
                   }
                   ajaxTimer++;              
              }
 		     
		}
		function callback(data){
		    document.getElementById("ajax").innerHTML += data;
		}
</script>
<input type="text" value="" id="username" />
<input type="text" value="" id="password" />
<input type="button" value="btn" onclick="crossDomain()" />

<div id="ajax"></div>
</body>

</html>
